import React from "react";
import { useLocation, useNavigate } from "react-router-dom";
import "./index.less";
const pathes = ["/home", "/fast", "/mine"];
export default function BackButton() {
  const { pathname } = useLocation();
  const nav = useNavigate();
  return (
    <div
      className="back"
      style={{ display: pathes.includes(pathname) ? "none" : "flex" }}
      onClick={() => nav(-1)}
    >
      返回上一页
    </div>
  );
}
